package com.itheima.fuxichengxu;

import java.util.Scanner;

public class ArraySum {
    public static void main(String[] args) {
        //1.创建键盘录入对象，准备键盘录入
        System.out.println("请录入数值");
        Scanner sc = new Scanner(System.in);
        //2.定义一个求和变量，准备记录累加后的结果
        int sum = 0;
        //3.动态初始化一个长度为5的int数组，准备存储键盘录入的数值
        int[] arr = new int[5];
        //4.将键盘录入的数值存储到数组中
        for (int i = 0; i <= arr.length - 1; i++) {
            arr[i] = sc.nextInt();
            sum += arr[i];
            System.out.println(arr[0]);
            System.out.println(arr[1]);
            System.out.println(arr[2]);
            System.out.println(arr[3]);
            System.out.println(arr[4]);
        }
        System.out.println(sum);

    }
}
